package com.sgl.blog.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @标题： ResourceMvcConfig
 * @内容：
 * @作者： 宋志豪
 */
@Configuration
public class ResourceMvcConfig implements WebMvcConfigurer {

    @Value("${upload.picture.filePath}")
    private String filePath;

    @Value("${upload.picture.visitPath}")
    private String visitPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(visitPath).addResourceLocations("file:" + filePath);
    }
}
